package com.example.controller;

import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhouxl
 * @DATE 2021/1/29
 * @descriptoin
 */
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("login")
    @ResponseBody
    public Object login(String name, String password) {
        return userService.login(name, password);
    }

    /**
     * 查询好友信息
     *
     * @param uid
     * @return
     */
    @RequestMapping("queryFriendsInfo")
    @ResponseBody
    public Object queryFriendsInfo(String uid) {
        return userService.queryFriendsInfo(uid);
    }

    /**
     * 查询非好友信息
     *
     * @return
     */
    @RequestMapping("searchFriends")
    @ResponseBody
    public Object searchFriends(String name, String uid) {
        return userService.searchFriends(name, uid);
    }

}
